#pragma once


enum class STATUS_TIPS_TYPE {
    STATUS_EMPTY_CONTENT,
    STATUS_LOADING,
    STATUS_LOAD_NEW,
    STATUS_LOAD_MORE,
    STATUS_LOAD_ERROR,
};


class XWnd : public SOUI::SHostWnd {
  public:
    XWnd(LPCWSTR xml);
    virtual ~XWnd();
    
  public:
    virtual void OnLogin() = 0;
    virtual void OnLogout() = 0;
    
    virtual void OnReqData() = 0;
    virtual void OnDelData() = 0;
    
    void showStatus(STATUS_TIPS_TYPE status, const SOUI::SStringW &ssTips = L"");
    void hideStatus();
    
  protected:
    BOOL OnInitDialog(HWND wndFocus, LPARAM lInitParam);
    
    void __OnShowWindow(BOOL bShow, UINT nStatus);
    
    LRESULT __OnLogin(UINT uMsg, WPARAM wParam, LPARAM lParam);
    LRESULT __OnLogout(UINT uMsg, WPARAM wParam, LPARAM lParam);
    
  public:
    // *INDENT-OFF*
    
    EVENT_MAP_BEGIN()
          EVENT_NAME_COMMAND(L"__btn_retry", OnReqData)
    EVENT_MAP_END()
    
    BEGIN_MSG_MAP_EX(XWnd)
        MSG_WM_INITDIALOG(OnInitDialog)
        MSG_WM_SHOWWINDOW(__OnShowWindow)
    
        MESSAGE_HANDLER_EX(WM_X_LOGIN, __OnLogin)
        MESSAGE_HANDLER_EX(WM_X_LOGOUT, __OnLogout)
    
        CHAIN_MSG_MAP(SOUI::SHostWnd)
        REFLECT_NOTIFICATIONS_EX()
    END_MSG_MAP()
    // *INDENT-ON*
  protected:
    req_flag_ptr    m_flag;
};
